﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace AmorCanino.Common
{
    public static class ConfigurationHandler
    {
        public static string GetHashSalt
        {
            get
            {
                return ConfigurationManager.AppSettings["HashSalt"];
            }
        }

        public static string GetFileLoggerPath
        {
            get
            {
                return ConfigurationManager.AppSettings["LogFileName"];
            }
        }

        public static string GetLoggerFactory
        {
            get
            {
                return ConfigurationManager.AppSettings["LoggerFactoryType"];
            }
        }

        public static string GetPuctirePath
        {
            get
            {
                return ConfigurationManager.AppSettings["PicturePath"];
            }
        }

        public static string ContactEmail
        {
            get
            {
                return ConfigurationManager.AppSettings["ContactEmail"];
            }
        }

        public static string SMTPServer
        {
            get
            {
                return ConfigurationManager.AppSettings["SMTPServer"];
            }
        }

        public static bool SMTPUserCredentials
        {
            get
            {
                bool outValue = false;
                bool.TryParse(ConfigurationManager.AppSettings["SMTPUserCredentials"], out outValue);
                return outValue;
            }
        }

        public static string EmailUsername
        {
            get
            {
                return ConfigurationManager.AppSettings["EmailUsername"];
            }
        }

        public static string EmailPassword
        {
            get
            {
                return ConfigurationManager.AppSettings["EmailPassword"];
            }
        }

        public static int GetAdoptedRecordsByPage
        {
            get
            {
                int result = 0;

                if (int.TryParse(ConfigurationManager.AppSettings["AdoptedRecordsByPage"], out result))
                {
                    return result;
                }

                return 0;
            }
        }

        public static int GetBridingRecordsByPage
        {
            get
            {
                int result = 0;

                if (int.TryParse(ConfigurationManager.AppSettings["BridingRecordsByPage"], out result))
                {
                    return result;
                }

                return 0;
            }
        }

        public static int AdoptablePets
        {
            get
            {
                int result = 2;

                if (int.TryParse(ConfigurationManager.AppSettings["HowManyAdoptablePets"], out result))
                {
                    return result;
                }

                return result;
            }
        }

        public static int BridablePets
        {
            get
            {
                int result = 2;

                if (int.TryParse(ConfigurationManager.AppSettings["HowManyBridablePets"], out result))
                {
                    return result;
                }

                return result;
            }
        }

        public static int NewArticles
        {
            get
            {
                int result = 10;

                if (int.TryParse(ConfigurationManager.AppSettings["HowManyNewArticles"], out result))
                {
                    return result;
                }

                return result;
            }
        }

        public static int MarkedArticles
        {
            get
            {
                int result = 10;

                if (int.TryParse(ConfigurationManager.AppSettings["HowManyMarkedArticles"], out result))
                {
                    return result;
                }

                return result;
            }
        }
    }
}
